//
// Created by gxy on 2025/8/31.
//

#include <common.h>

int find(vector<int>& s1,vector<int>& s2,vector<int>& s3) {
    int res = INT_MAX/2;
    for (int i = 0; i < s1.size(); i++) {
        for (int j = 0; j < s2.size(); j++) {
            for (int k = 0; k < s3.size(); k++) {
                int tmp=abs(s1[i] - s2[j]) + abs(s1[i] - s3[k]) +abs(s2[j] - s3[k]);
                if (tmp< res) {
                    res=tmp;
                }
            }
        }
    }
    return res;
}

int main(int argc, char *argv[]) {
    vector<int> s1{-1,0,9};
    vector<int> s2{-25,-10,10,11};
    vector<int> s3{2,9,17,30,41};
    int res = find(s1,s2,s3);
    cout << res << endl;
    return 0;
}
